3.49 \(\int \frac{\tan ^2(c+d x)}{a+i a \tan (c+d x)} \, dx\)

Optimal. Leaf size=50 \[ -\frac{i}{2 d (a+i a \tan (c+d x))}+\frac{i \log (\cos (c+d x))}{a d}+\frac{x}{2 a} \]

[Out]

x/(2*a) + (I*Log[Cos[c + d*x]])/(a*d) - (I/2)/(d*(a + I*a*Tan[c + d*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.0552606, antiderivative size = 50, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 24, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.083, Rules used = {3540, 3475} \[ -\frac{i}{2 d (a+i a \tan (c+d x))}+\frac{i \log (\cos (c+d x))}{a d}+\frac{x}{2 a} \]

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]^2/(a + I*a*Tan[c + d*x]),x]

[Out]

x/(2*a) + (I*Log[Cos[c + d*x]])/(a*d) - (I/2)/(d*(a + I*a*Tan[c + d*x]))

Rule 3540

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> -Simp[
(b*(a*c + b*d)^2*(a + b*Tan[e + f*x])^m)/(2*a^3*f*m), x] + Dist[1/(2*a^2), Int[(a + b*Tan[e + f*x])^(m + 1)*Si
mp[a*c^2 - 2*b*c*d + a*d^2 - 2*b*d^2*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0] && LeQ[m, -1] && EqQ[a^2 + b^2, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \frac{\tan ^2(c+d x)}{a+i a \tan (c+d x)} \, dx &=-\frac{i}{2 d (a+i a \tan (c+d x))}+\frac{\int (a-2 i a \tan (c+d x)) \, dx}{2 a^2}\\ &=\frac{x}{2 a}-\frac{i}{2 d (a+i a \tan (c+d x))}-\frac{i \int \tan (c+d x) \, dx}{a}\\ &=\frac{x}{2 a}+\frac{i \log (\cos (c+d x))}{a d}-\frac{i}{2 d (a+i a \tan (c+d x))}\\ \end{align*}

Mathematica [A]  time = 0.291808, size = 86, normalized size = 1.72 \[ \frac{4 \tan ^{-1}(\tan (d x)) (\tan (c+d x)-i)+2 \log \left (\cos ^2(c+d x)\right )+\tan (c+d x) \left (2 i \log \left (\cos ^2(c+d x)\right )-2 d x+i\right )+2 i d x-1}{4 a d (\tan (c+d x)-i)} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]^2/(a + I*a*Tan[c + d*x]),x]

[Out]

(-1 + (2*I)*d*x + 2*Log[Cos[c + d*x]^2] + (I - 2*d*x + (2*I)*Log[Cos[c + d*x]^2])*Tan[c + d*x] + 4*ArcTan[Tan[
d*x]]*(-I + Tan[c + d*x]))/(4*a*d*(-I + Tan[c + d*x]))

________________________________________________________________________________________

Maple [A]  time = 0.022, size = 59, normalized size = 1.2 \begin{align*}{\frac{-{\frac{3\,i}{4}}\ln \left ( \tan \left ( dx+c \right ) -i \right ) }{ad}}-{\frac{1}{2\,ad \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{{\frac{i}{4}}\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{ad}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^2/(a+I*a*tan(d*x+c)),x)

[Out]

-3/4*I/d/a*ln(tan(d*x+c)-I)-1/2/a/d/(tan(d*x+c)-I)-1/4*I/d/a*ln(tan(d*x+c)+I)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 2.32638, size = 161, normalized size = 3.22 \begin{align*} \frac{{\left (6 \, d x e^{\left (2 i \, d x + 2 i \, c\right )} + 4 i \, e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - i\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{4 \, a d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/4*(6*d*x*e^(2*I*d*x + 2*I*c) + 4*I*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - I)*e^(-2*I*d*x - 2*I*c
)/(a*d)

________________________________________________________________________________________

Sympy [A]  time = 2.76378, size = 68, normalized size = 1.36 \begin{align*} \frac{\left (\begin{cases} 3 x e^{2 i c} - \frac{i e^{- 2 i d x}}{2 d} & \text{for}\: d \neq 0 \\x \left (3 e^{2 i c} - 1\right ) & \text{otherwise} \end{cases}\right ) e^{- 2 i c}}{2 a} + \frac{i \log{\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**2/(a+I*a*tan(d*x+c)),x)

[Out]

Piecewise((3*x*exp(2*I*c) - I*exp(-2*I*d*x)/(2*d), Ne(d, 0)), (x*(3*exp(2*I*c) - 1), True))*exp(-2*I*c)/(2*a)
+ I*log(exp(2*I*d*x) + exp(-2*I*c))/(a*d)

________________________________________________________________________________________

Giac [A]  time = 1.62005, size = 81, normalized size = 1.62 \begin{align*} -\frac{\frac{3 i \, \log \left (\tan \left (d x + c\right ) - i\right )}{a} + \frac{i \, \log \left (i \, \tan \left (d x + c\right ) - 1\right )}{a} + \frac{-3 i \, \tan \left (d x + c\right ) - 1}{a{\left (\tan \left (d x + c\right ) - i\right )}}}{4 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/4*(3*I*log(tan(d*x + c) - I)/a + I*log(I*tan(d*x + c) - 1)/a + (-3*I*tan(d*x + c) - 1)/(a*(tan(d*x + c) - I
)))/d